FROM fedora:36
LABEL \
    name="bodhi-base" \
    vendor="Fedora Infrastructure" \
    license="MIT"
{% if env == "staging" %}
RUN curl -o /etc/yum.repos.d/infra-tags-stg.repo https://infrastructure.fedoraproject.org/infra/ansible/files/common/fedora-infra-tags-stg.repo
{% else %}
RUN curl -o /etc/yum.repos.d/infra-tags.repo https://infrastructure.fedoraproject.org/infra/ansible/files/common/fedora-infra-tags.repo
{% endif %}
{% if env == "staging" %}
RUN dnf install -y bodhi-server python3-pyramid_sawing python3-gunicorn sed --refresh
{% else %}
RUN dnf install -y bodhi-server-{{bodhi_version}} python3-pyramid_sawing python3-gunicorn sed
{% endif %}

# HOTFIX for https://github.com/fedora-infra/bodhi/pull/4687
RUN sed -i -e 's|verbose=False|verbose=True|' /usr/lib/python3.10/site-packages/bodhi/server/models.py

# link the static files for a simpler httpd.conf
RUN ln -s $(python3 -Ic "import sysconfig; print(sysconfig.get_path('purelib', 'rpm_prefix'))")/bodhi/server/static/ /srv/bodhi-static

# Set up krb5
RUN rm -f /etc/krb5.conf && \
    ln -sf /etc/bodhi/krb5.conf /etc/krb5.conf && \
    ln -sf /etc/keytabs/koji-keytab /etc/krb5.bodhi_bodhi{{ env_suffix }}.fedoraproject.org.keytab
ENV USER=openshift
